Cleanup and several new features