Improved overall structure and added some features