Fixed logic bugs. Implemented different box types in gui.