Completed logic, cleanup