cleaned up code scheme