code cleanup, reorganisation of JS injected code