Common behaviour abstraction

Hi there,

First of all thank you for this awesome gem.
I have plans to contribute more to this gem, here is a general clean up.
I will also write some tests for it as well as refactoring.

Thank you,

With regards,
Nalesso Antonio