Reorganize code. Add specs