Make framework agnostic and add tests