reworking scope and types
it kinda works