cleanup, borrowing code/features from pre-existing app