immediately upon his fathers death , leopold had masons and carpenters from berne construct a soldiers barracks , courtroom and prison cells just far enough outside the walls to be hardly visible from the main keep .