select filter with buttons and tidy up javascript