split vs into several files and added support of having the apex in constmem