Moved version defenition to more logical place and improved entry point checks

Change-Id: Iabbfbaea3340b123b7bafadde78964aee3a7a159