Finished implementation. Before tests