improve internal code