Refactor gallery and add client-side basic pagination – Fix #11