Major refactor (not completely tested yet)

* wanted to make the initial element an <input> tag
* made the code more closely follow bootstrap style
* made the code handle empty fields more gracefully