Module code cleanup

Declaration of module more simple right now.
Fixing bug with wrong event_source usage (mix of local and global ids) when registering handler. Now you should use event_source_constructor.