code cleanup and added settlement in units