Change return type of getSelected. Clean up a bit.