added selection menu, fixed bugs