Reworked js into new Convert function. Much slicker now