Bug fixes and some refactor