fixed some stuff; needs cleanup