updated to pull classes out into own files, also added lockfile code