split functions into multiple files
fixed a bug where the selection worked backwards