Made a few changes to functionality