initial code that should more or less work with some debugging