implemented FB api and strucgtured code