Fixed Linux compiler errors and some cleanup work