Added features and fixed bugs