implemented most of the select component functionality