some refactoring done. deleted const and varname functions (allready inside bmachine)