Code cleanup, history fully implemented