Copied all codes from pinterest