Separated the CODE into several .h and .cpp files