major updates, completely re-wrote