Improvements and refactory