updated to be usable as a standalone class