Adds implementation of choose, simplifies implementation.
Removes unnecessary pragmas.