Cleaned up the code a bit.
Orderline creation added on pre-save.