Refactoring

Tried to improve cohesion, also renamed some files.