Initial code drop including a quick bugfix