Wrote specs for OS and did some refactoring