Improved functionality and updated tests