Code cleanup, simplification