Initial commit ... works but is missing some features and minor refactors