Refactoring the main routine (place()). Also fix #2.