Move classes to separate source files

* Add testing code with if __FILE__ == $0