fixed gravity darkening part of the code; need to optimize