Corrected a bug, implemented more functionality