completely rebuilt for easier and faster api