Clean up formatting and remove unused variables