Code clean up - first attempt