I'm sure there is a better way of doing this conversion. Any suggestions?