Changed the way commands are handled and reorganised classes