Add extra tests andrefactor