Code maintanance and fix ups