Made new functions. Still need debugging.