Finished, Code is ugly and could be refactored