split everything into .h and .cpp files properly and can now compile