Relocating source to lib directory and refactoring.