Minor fixes, some refactor and deletion of unnecessary files