Added a few features to the code