Cleaned up code, removing console prints