64bit compiler support. Little refactoring