cleaned up based on comments