Update

Code cleaned-up and organised, additional fixes