Code cleanup

This makes the code work portably.