Final version with all functional - Some stuff needs to be changed