improvements and refactors