Refactored to main file, and added .h