some stylistic changes; basically all the functionality in place