Finished implementing logic. It works