shape functions working but buggy