Updated code for more features