Bux fixes and removed duplication of code

* Used decorators to avoid repetition of code
* Bug fixes, https://bugzilla.redhat.com/show_bug.cgi?id=747839 
* Bug fixed AttributeError: 'NoneType' object has no attribute