Moved some functionality to different files for clarity