Finished code, still debugging left to do