improved the classes code