Added more logic, finish, still buggy atm