Current implementation seems hacky, could be done better in JS.
Current implementation seems hacky, could be done better in JS.