Deprecated some abstraction and fixed a memory leak.