From home (11/4/2014): Cleaned up code. Added new parameters.