Finished, but need a deep refactoring