Tidied up API component (not complete)