Add common code needed in subclasses to base class

This pull request is related to another in leap_client (i'll put issue # in a comment).
Should be merged/discarded together or will not work.