Fleshed out functionality (untested).