Cleaned up code for older gcc