fixed a bunch of strcutural issues