Code cleanup & handling