* Better error checking in sample
* Margin setting