final version without classes