done some reformatting, added some functionality