Code cleanup mostly