Code cleaning/updates/potential bug fixes