Fixed compilation error and cleanup