Restructured files. Added controller and factory.