Refactor to clean up percent/pixels

Doesn't allow nonsense units by resetting to pixels if a nonsense unit is provided.