Code cleanup & tidying