Making some changes and adding new functions