Separated things into their own files. Added scheduler.