Minor improvements. Clean up code