Clean code and add spec file