Some functions still need a bit of modifications, its starting to work.