split grenade in three files, reorganize code