now compiles and added some method abstraction